package com.briup.cms.service.impl;

import com.briup.cms.bean.Privilege;
import com.briup.cms.bean.extend.PrivilegeExtend;
import com.briup.cms.dao.PrivilegeMapper;
import com.briup.cms.service.IPrivilegeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class PrivilegeServiceImpl implements IPrivilegeService {
    @Resource
    private PrivilegeMapper privilegeMapper;


    @Override
    public List<Privilege> findAll() {
        return privilegeMapper.selectAll();
    }

    @Override
    public List<Privilege> findInNm(String name) {
        return privilegeMapper.selectInNm(name);
    }

    @Override
    public void insertOrUpdate(Privilege privilege) {
        if (privilege.getId()!=null){
            privilegeMapper.change(privilege);
        }
        else{
            privilegeMapper.insert(privilege);
        }
    }

    @Override
    public void deleteInId(Long id) {
        privilegeMapper.delete(id);
    }
}
